{temp('kefu/head')}
</head>
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i>首页
	<span class="c-gray en">&gt;</span>用户管理
	<span class="c-gray en">&gt;</span>专家列表
	<a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
		<i class="Hui-iconfont">&#xe68f;</i>
	</a>
</nav>
<div style="color:red;text-align: right;">
	冻结为禁止用户登录，
	解冻为恢复用户登录权限，
	重置为将用户密码重置为“123456”。
</div>
<div class="pd-20" style="margin-top:-30px;">
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<th width="80">专家ID</th>
					<th width="80">专家号</th>
					<th width="80">关联企业ID</th>
					<th width="80">类型</th>
					<th width="120">注册时间</th>
					<th width="">上次登陆时间</th>
					<th width="420">操作</th>
				</tr>
			</thead>
			<tbody>
			{if(@$rs)}
				{foreach($rs as $k=>$v)}
				<tr class="text-c">
					<td>
						{$v['id']}
					</td>
					<td>{if($v['type'] == 1)} {$v['phone']} {elseif($v['type'] ==2)} {$v['email']} {else}{/if}</td>
					<td>{$v['qyid']}</td>
					<td>{if($v['lx'] == '1')}普通专家{elseif($v['lx'] == '2')}VIP专家{/if}</td>
					<td>{code(echo date('Y-m-d H:i:s',$v['time']))}</td>
					<td>{code(echo date('Y-m-d H:i:s',$v['dltime']))}</td>
					<td class="f-14 td-manage">
						<button style="border:0px;color:#ffffff;background-color:#68b828;padding:4px 8px;cursor:pointer;float:left;margin-left:30px;" onclick="article_edit('编辑','{$_url}/kefu/?act=user&met=zj_xiu&id={$v['id']}',{$v['id']})">编辑</button>
						<button style="border:0px;color:#ffffff;background-color:#cc3f44;padding:4px 8px;cursor:pointer;float:left;margin-left:10px;" onclick="dong({$v['id']},1)">{if($v['dongjie'] == 1)}解冻{else}冻结{/if}</button>
						<button style="border:0px;color:#ffffff;background-color:#40bbea;padding:4px 8px;cursor:pointer;float:left;margin-left:10px;" onclick="dong({$v['id']},2)">重置密码</button>
						<button style="border:0px;color:#ffffff;background-color:#f7aa47;padding:4px 8px;cursor:pointer;float:left;margin-left:10px;" onclick="czimg({$v['id']},{if($v['lx'] == '2')}2{else}1{/if})">重置头像</button>
						{if($v['lx'] == '1')}
						<button style="border:0px;color:#ffffff;background-color:#00b19d;padding:4px 8px;cursor:pointer;float:left;margin-left:10px;" onclick="vip({$v['id']})">升级为VIP专家</button>
						{/if}
					</td>
				</tr>
				{/foreach}
			{/if}
			</tbody>
		</table>
	</div>
</div>
<script type="text/javascript">
$('.table-sort').dataTable({
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
	"bStateSave": true,//状态保存
});

/*新闻-编辑*/
function article_edit(title,url,id,w,h){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}

function vip(id){//升级为VIP专家
	$.post('{$_url}/kefu/?act=user&met=sjvip',{id:id},function(data){
		if(data == 'cg'){
			layer.alert('升级成功');
			setTimeout(function(){location.href = '';},800);return ;
		}else if(data == 'error'){
			layer.alert('升级失败');return ;
		}else if(data == '-1'){
			layer.alert('该专家已经是VIP专家');return ;
		}
	});
}

function czimg(id,type){//重置头像
	$.post('{$_url}/kefu/?act=user&met=czimg',{id:id,type:type},function(data){
		if(data == 'cg'){
			layer.alert('重置成功');
			setTimeout(function(){location.href = '';},800);return ;
		}else if(data == 'error'){
			layer.alert('重置失败');return ;
		}
	});
}

function dong(id,type){//冻结
	$.post('{$_url}/admin/?act=recruit&met=zjia_bianji{$gnpd}',{id:id,type:type},function(data){
		if(data == 'cg'){
			if(type == 1){
				layer.alert('修改成功');
			}else{
				layer.alert('重置成功');
			}
			setTimeout(function(){location.href = '';},800);return ;
		}else if(data == 'error'){
			if(type == 1){
				layer.alert('修改失败');return ;
			}else{
				layer.alert('重置失败');return ;
			}
		}else{
			layer.alert(data);return ;
		}
	});
}
</script>
{temp('kefu/foot')}
</body>
</html>